home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Amos / AMOSList-1097 / AMOSLIST / text0203.txt < prev    next >
Encoding:
Text File  |  1998-06-24  |  3.6 KB  |  115 lines

  1. 'As requested, here is my set of CD32 Pad procedures. Feel free to use them
  2. 'for your own programs. The CD32 Pad procedure uses the same values as the
  3. 'Joy(X) command for the CD32_TEXT procedure, which allows you to use a
  4. 'standard joystick for entry as well.
  5.  
  6. 'Test the test entry procedure
  7.  
  8. Locate 0,0 : Print "Up/Down to select, Left to delete, Right to enter, Fire
  9. when done"
  10.  
  11. CD32_TEXT[8,32,20] : TXT$=Param$
  12.  
  13. Print "text entered: ";TXT$
  14. Wait 60
  15.  
  16. 'Test the CD32 buttons
  17.  
  18. Do
  19. PAD : CD32=Param
  20. Clw : Home
  21. If CD32 and 1 Then Print "Up ";
  22. If CD32 and 2 Then Print "Down ";
  23. If CD32 and 4 Then Print "Left ";
  24. If CD32 and 8 Then Print "Right ";
  25. If CD32 and 16 Then Print "Red ";
  26. If CD32 and 32 Then Print "Blue ";
  27. If CD32 and 64 Then Print "Green ";
  28. If CD32 and 128 Then Print "Yellow ";
  29. If CD32 and 256 Then Print "Rewind ";
  30. If CD32 and 512 Then Print "Fast Forward ";
  31. If CD32 and 1024 Then Print "Pause ";
  32. Loop
  33.  
  34. Procedure PAD
  35. PAD:
  36. CD=0 : CD32=0
  37. Lib Open 3,"lowlevel.library",40
  38. Dreg(0)=1
  39. CD=Lib Call(3,-30)
  40. If CD and 1 Then CD32=CD32+%1000 : Rem Right
  41. If CD and 2 Then CD32=CD32+%100 : Rem Left
  42. If CD and 4 Then CD32=CD32+%10 : Rem Down
  43. If CD and 8 Then CD32=CD32+%1 : Rem Up
  44. If CD and 131072 Then CD32=CD32+%10000000000 : Rem Pause
  45. If CD and 262144 Then CD32=CD32+%100000000 : Rem Rewind
  46. If CD and 524288 Then CD32=CD32+%1000000000 : Rem Fast Forward
  47. If CD and 1048576 Then CD32=CD32+%1000000 : Rem Green
  48. If CD and 2097152 Then CD32=CD32+%10000000 : Rem Yellow
  49. If CD and 4194304 Then CD32=CD32+%10000 : Rem Red
  50. If CD and 8388608 Then CD32=CD32+%100000 : Rem Blue
  51. Lib Close 3
  52. End Proc[CD32]
  53.  
  54. Procedure CD32_TEXT[TX,TY,IN]
  55. CHAR$="" : CHAR=0 : A$="" : IN$="" : PAD=0
  56.  
  57. 'You can add characters to the set by including them in CHAR$
  58.  
  59. CHAR$="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,.!?() 1234567890"
  60. CHAR=1
  61. Curs Off 
  62. CD32:
  63.  
  64. 'If you have added characters, make sure the 69 is set to the length of
  65. 'your character string.
  66.  
  67. If CHAR<1 Then CHAR=69
  68. If CHAR>69 Then CHAR=1
  69. A$=Mid$(CHAR$,CHAR,1)
  70. B$=IN$+A$+" "
  71. Ink 7,0 : Text TX,TY,B$
  72. CD32A:
  73. Do : PAD=0 : PAD : PAD=Param : If PAD=0 Then Loop
  74.  
  75. 'To use a joystick instead, replace the above line with:
  76. 'Do : PAD=Joy(0) : If PAD=0 Then Loop
  77.  
  78. If Len(IN$)=IN Then Goto CD32A
  79. If PAD and 2 Then CHAR=CHAR-1 : Wait 5 : Goto CD32
  80. If PAD and 1 Then CHAR=CHAR+1 : Wait 5 : Goto CD32
  81. If PAD and 16
  82.  IN$=IN$+A$
  83.  Text TX,TY,IN$
  84.  Goto CD32B
  85. End If 
  86. If PAD and 4 Then IN$=Left$(IN$,Len(IN$)-1) : Wait 15 : Goto CD32
  87. If PAD and 8 Then IN$=IN$+A$ : Wait 10 : Goto CD32
  88. Goto CD32A
  89. CD32B:
  90. End Proc[IN$]
  91.  
  92. 'TX and TY are graphic coordinates for the text. IN is the allowed length of
  93. 'the string to be entered. The text procedure returns the string as a
  94. parameter
  95. 'and uses the PAD procedure for its input.
  96.  
  97. 'Up  scrolls forward through the character set. Down scrolls back through the
  98. 'character set. Left deletes the current character. Right moves to the next
  99. 'character. Red (Fire) ends input.
  100.  
  101. Well met and godspeed,
  102.                       Giark
  103.                                            joehick@golden.net
  104.                              http://www.golden.net/~joehick/fbn/index.html
  105.      ______  ______    _____  .------------------------------------------.
  106.     / ____/ / __  /   / ___ \ !     AMOS games, utilities, demos, etc.   !
  107.    / /__   / /_/ /   / /  / / !                                          !
  108.   / ___/  / ___  |  / /  / /  !       CyberSpace BBS (519)579-0072       !
  109.  / /     / /__/ /  / /  / /   !     on A2000 060/50MHz (519)579-0173     !
  110. /_/     /______/  /_/  /_/    !                                          !
  111.    Fly By Nite Videe-Oh!      !  FBN Amiga 500 020 14MHz 1C/5F RAM 3.1OS !
  112.          IAPA Member          `------------------------------------------'
  113.  
  114.  
  115.